class Solution {
public:
    int climbStairs(int n) {
        if (n <= 2) {
            return n;
        }
        int prev_prev = 1;
        int prev = 2;
        int current;
        for (int i = 3; i <= n; ++i) {
            current = prev_prev + prev;
            prev_prev = prev;
            prev = current;
        }
        return prev;
    }
};
